<template>
	<view class="page-head" >
		<view class="head-hd" @click="pageBack" v-if="isBack">
			<image class="backimg" src="../../static/back.png" mode=""></image>
		</view>
		<view class="head-bd">{{title}}</view>
	</view>
</template>

<script>
	export default {
		name:"nav-top",
		props: {
			// 一级页面一般用relative，二级页面一般用fixed
			position: {
				type: String,
				default: 'fixed'
			},
			// 一级页面不要返回按钮
			isBack: {
				type: Boolean,
				default: true
			},
			// 导航栏标题
			title: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
			
			};
		},
		methods: {
			pageBack() {
				uni.navigateBack();
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page-head{
		z-index: 999;
		left: 0;
		right: 0;
		padding: 0 30rpx;
		display: flex;
		align-items: center;
		font-size: 36rpx;
		color: #fff;
		.head-hd{
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			width: 40rpx;
			height: 100%;
			.backimg{
				width: 20rpx;
				height: 36rpx;
			}
		}
		.head-bd{
			position: absolute;
			left: 140rpx;
			right: 140rpx;
			min-width: 0;
			text-align: center;
			font-size: 32rpx;
		}
	}
</style>
